package com.chaychan.bottombarlayout_ohos.slice;

import com.chaychan.bottombarlayout_ohos.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;

public class MainAbilitySlice extends AbilitySlice {


    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        Text UseWithViewPager = (Text) findComponentById(ResourceTable.Id_UseWithViewPager);
        Text UseWithoutViewPager = (Text) findComponentById(ResourceTable.Id_UseWithoutViewPager);
        Text DynamicAddItem = (Text) findComponentById(ResourceTable.Id_DynamicAddItem);
        Text UseLottieDemo = (Text) findComponentById(ResourceTable.Id_UseLottieDemo);
        UseWithViewPager.setClickedListener(component -> {
            present(new ViewPagerDemoActivity(), new Intent());
        });
        UseWithoutViewPager.setClickedListener(component -> {
            present(new FragmentManagerActivity(MainAbilitySlice.this), new Intent());
        });
        DynamicAddItem.setClickedListener(component -> {
            present(new DynamicAddItemActivity(MainAbilitySlice.this), new Intent());
        });

        UseLottieDemo.setClickedListener(component -> {
            present(new LottieDemoActivity(), new Intent());
        });
    }


    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
